getStatus() always returns a number — the HTTP status code. getResponse() returns either a string or an object depending on how the exception was constructed. When thrown with a string message it returns that string. When thrown with an object it returns that object. When thrown with no arguments it returns a default object with statusCode, message, and error fields.
Always guard with typeof res === 'string' before accessing .message — both shapes are valid.
getStatus() is always a number — safe to use directly without type checking.
Omitting the typeof check is the most common bug in custom exception filters.
When the body is an object, access nested fields like (body as any).message or use optional chaining.
exception.message is always a string — a safe alternative to getResponse() for simple use cases.